Skip to content

Conversation

@Q1w1N
Copy link
Contributor

@Q1w1N Q1w1N commented Feb 21, 2024

Adding new init command

Summary

init command can be triggered manually, and it triggers automatically if prompt i run withour config file.

Test plan

Run through all use cases.

@Q1w1N Q1w1N requested a review from mdjastrzebski February 21, 2024 12:42
describe: 'Verbose output',
}),
handler: (args) => run(args._.join(' '), args),
handler: (args) => {
Copy link
Member

@mdjastrzebski mdjastrzebski Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[high] Instead of trying to handle it here, you should modify bin.ts to include init command as well.

},
{
type: 'confirm',
message: 'Do you already have OpenAI API key?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are asking about OpenAI api key, what about case when user wanted to provide only Perplexity key?

{
type: (prev) => (prev ? 'password' : null),
name: 'apiKey',
message: 'Paste your OpenAI key here:',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto Perplexity key.

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. I've noticed some issue to be handled:

  1. Prompt always ask for OpenAI key (message is fixed to OpenAI)
  2. init command should be configured on bin.ts level, not inside prompt.ts
  3. We currently have ~.airc file which is a JSON file but without .json extension editors might not recognize it as such.

In order to mitigate it for early adopters, let's a a simple code that runs early and moves ~.airc.json file to ~/.airc.json

const LEGACY_CONFIG_FILE = `.airc`;
const CONFIG_FILE = `.airc.json`;

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Pls resolve comments before merging @Q1w1N.

@Q1w1N Q1w1N linked an issue Feb 22, 2024 that may be closed by this pull request
@Q1w1N Q1w1N merged commit 83df15c into main Feb 22, 2024
@Q1w1N Q1w1N deleted the init-command branch February 22, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: init command

3 participants